*     *****************************************************************   *;
*     *****************************************************************   *; 
*   Date:          December 27, 2021                               	      *;
*   Authors:       Lisa Dellmuth and Jonas Tallberg				          *;  
*   Purpose: 	   Analyses for book Legitimacy Politics: Elite  		  *;
*    Communication and Public Opinion in Global Governance (CUP, 2023)    *;
*     ****************************************************************    *;
*     ****************************************************************    *;

*Fig 2.6

*elite by IO - bar
use "Leggov elite survey 19 sept 2019.dta", clear

tab country

sum confUN-confFIFA
recode confUN 1=0 2=0 3=1 4=1 // create dummies for the calculation of percentages
recode confIMF 1=0 2=0 3=1 4=1
recode confICC 1=0 2=0 3=1 4=1
recode confNATO 1=0 2=0 3=1 4=1
recode confWB 1=0 2=0 3=1 4=1
recode confWHO 1=0 2=0 3=1 4=1
recode confWTO 1=0 2=0 3=1 4=1
recode confUNFCCC 1=0 2=0 3=1 4=1
recode confUNSC 1=0 2=0 3=1 4=1
recode confG20 1=0 2=0 3=1 4=1
recode confAU 1=0 2=0 3=1 4=1
recode confEU 1=0 2=0 3=1 4=1
recode confASEAN 1=0 2=0 3=1 4=1
recode confNAFTA 1=0 2=0 3=1 4=1
recode confMERCOSUR 1=0 2=0 3=1 4=1
recode confSCO 1=0 2=0 3=1 4=1
recode confgov 1=0 2=0 3=1 4=1

set scheme plotplain

collapse confUN-confG20 confgov, by(country) 
ed

reshape long conf, i(country) j(inst, string)

replace inst="Gov." if inst=="gov" 


graph bar conf, over(inst, sort(conf) descending) ///
ylabel(0 "0%" .20 "20%" .40 "40%" .60 "60%" .80 "80%" 1.00 "100%", labsize(small) angle(horizontal) ///
glcolor(gs14) gmax) bar(3, color(g2)) ytitle("% quite a lot or a great deal of confidence") ylabel(,gstyle(minor)) legend(off) 

